package elEMAS.impl;

import java.util.Properties;

public class ElEmasHelpers {
    
    public static ElEmasParameters getElEmasParameters(Properties properties) {
        
        ElEmasParameters params = new ElEmasParameters();
        params.inputFile = properties.getProperty("inputFile");
        params.timeLimit = Integer.parseInt(properties.getProperty("timeLimit"));
        params.agentsNum = Integer.parseInt(properties.getProperty("agentsNum"));
        params.basicEnergyQuantum = Integer.parseInt(properties.getProperty("basicEnergyQuantum"));
        params.dieThreshold = Integer.parseInt(properties.getProperty("dieThreshold"));
        params.elitistPrestigeLimit = Integer.parseInt(properties.getProperty("elitistPrestigeLimit"));
        params.islandNum = Integer.parseInt(properties.getProperty("islandNum"));
        params.migrationProbability = Double.parseDouble(properties.getProperty("migrationProbability"));
        params.neighbourDistance = Double.parseDouble(properties.getProperty("neighbourDistance"));
        params.prestigeQuantum = Integer.parseInt(properties.getProperty("prestigeQuantum"));
        params.reproductionThreshold = Integer.parseInt(properties.getProperty("reproductionThreshold"));
        params.startAgentEnergy = Integer.parseInt(properties.getProperty("startAgentEnergy"));
        params.stepNum = Integer.parseInt(properties.getProperty("stepsNum"));
        params.ref_f0 = Double.parseDouble(properties.getProperty("ref_f0"));
        params.ref_f1 = Double.parseDouble(properties.getProperty("ref_f1"));
        params.hvCalcInterval = Integer.parseInt(properties.getProperty("hvCalcInterval"));
        return params;
    }
    
    public static EmasParameters getEmasParameters(Properties properties) {
        
        EmasParameters params = new EmasParameters();
        params.inputFile = properties.getProperty("inputFile");
        params.timeLimit = Integer.parseInt(properties.getProperty("timeLimit"));
        params.agentsNum = Integer.parseInt(properties.getProperty("agentsNum"));
        params.basicEnergyQuantum = Integer.parseInt(properties.getProperty("basicEnergyQuantum"));
        params.dieThreshold = Integer.parseInt(properties.getProperty("dieThreshold"));
        params.islandNum = Integer.parseInt(properties.getProperty("islandNum"));
        params.migrationProbability = Double.parseDouble(properties.getProperty("migrationProbability"));
        params.reproductionThreshold = Integer.parseInt(properties.getProperty("reproductionThreshold"));
        params.startAgentEnergy = Integer.parseInt(properties.getProperty("startAgentEnergy"));
        params.stepNum = Integer.parseInt(properties.getProperty("stepsNum"));
        params.ref_f0 = Double.parseDouble(properties.getProperty("ref_f0"));
        params.ref_f1 = Double.parseDouble(properties.getProperty("ref_f1"));
        params.hvCalcInterval = Integer.parseInt(properties.getProperty("hvCalcInterval"));
        return params;
    }

}
